package cn.tedu.rtc.mqtt.model;

import java.util.Arrays;

/**
 * EventsRouter筛选路由枚举类
 */
public enum EventsMethodEnum {

    DEVICE_A("device_a", ChannelName.INBOUND_EVENTS_CONTROL),

    DEVICE_B("device_b", ChannelName.INBOUND_EVENTS_CONTROL),

    UNKNOWN("Unknown", ChannelName.DEFAULT);

    private String method;

    private String channelName;

    EventsMethodEnum(String method, String channelName) {
        this.method = method;
        this.channelName = channelName;
    }

    public String getMethod() {
        return method;
    }

    public String getChannelName() {
        return channelName;
    }

    public static EventsMethodEnum find(String method) {
        return Arrays.stream(EventsMethodEnum.values())
                .filter(methodEnum -> methodEnum.method.equals(method))
                .findAny()
                .orElse(UNKNOWN);
    }
}
